<?php
class My_xmlrpc_wp {
	private function login($username, $password) {
		$login = new My_Login ( );
		$data = $login->login ( $username, $password );
		if (! $data)
			throw new Zend_XmlRpc_Server_Exception ( '403', 403 );
		return $data;
	}
	
	/** 
	 *@param string $blog_id 
	 *@param string $username 
	 *@param string $password    
	 *@return array 
	 */
	function getCategories($blog_id, $username, $password) {
		$kid = $this->login ( $username, $password )->ke_id;
		$db = Zend_Registry::get ( 'db' );
		$select = new Zend_Db_Select ( $db );
		$select->from ( 'bc_lanmu' );
		$select->where ( 'kid = ?', $kid );
		$categories = $db->fetchAll ( $select );
		foreach ( $categories as $k => $v ) {
			$a [$k] ['categoryId'] = $v ['id'];
			$a [$k] ['categoryName'] = $v ['name'];
			$a [$k] ['description'] = $v ['name'];
			$a [$k] ['parentId'] = '1';
			$a [$k] ['rssUrl'] = '41';
			$a [$k] ['htmlUrl'] = 'http://www.myued.com/?cat=27';
		}
		return $a;
	}
	/** 
	 *@param string $blog_id 
	 *@param string $username 
	 *@param string $password    
	 *@return array 
	 */
	function getAuthors($blog_id, $username, $password) {
		$a ['user_id'] = $this->login ( $username, $password )->id;
		$a ['display_name'] = $username;
		return array ($a );
	}
	/**
	 *@param string $blog_id 
	 *@param string $username 
	 *@param string $password    
	 *@param struct $data    
	 */
	function uploadFile($blog_id, $username, $password, $data) {
		return true;
	}
}
?>